//
//  WXLBaseModel.m
//  段子手
//
//  Created by dllo on 16/3/17.
//  Copyright © 2016年 JokesTeam. All rights reserved.
//

#import "WXLBaseModel.h"

@implementation WXLBaseModel

- (instancetype)initWithDic:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}


+ (instancetype)modelWithDic:(NSDictionary *)dic {
    NSArray *arr = [dic allKeys];
    if (!arr.count) {
        return Nil;
    }
    // [self class] 本类对象
    return [[[self class] alloc] initWithDic:dic];
}

+ (NSMutableArray *)modelHandelWithArray:(NSArray *)array {
    NSMutableArray *arrModel = [NSMutableArray array];
    for (NSDictionary *dic in array) {
        id model = [[self class] modelWithDic:dic];
        [arrModel addObject:model];
    }
    return arrModel;
}


- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)valueForUndefinedKey:(NSString *)key {
    return @"没有key";
}

- (void)dealloc {
    
}


@end
